#include <iostream>
using namespace std;
 
class A1 {
    int a1;
 
public:
    A1(int _a1) : a1(_a1) {
        std::cout<<"A1 constructor"<<endl;
    }
    ~A1()
    {
         std::cout<<"A1 destructor"<<endl;
    }
};
 
class A2 {
    int a2;
 
public:
    A2(int _a2) : a2(_a2) {
        std::cout<<"A2 constructor"<<endl;
    }
    ~A2() {
        std::cout<<"A2 destructor"<<endl;
    }
};
 
class B : public A2, public A1 {
    int b;
 
public:
    B(int _a1, int _b, int _a2) : A1(_a1), b(_b), A2(_a2){
        std::cout<<"B constructor"<<endl;
    }
    ~B() {
        std::cout<<"B destructor"<<endl;
    }
};

int main()
{
    B b(1, 2, 3);
    return 0;

}